import React, {Component} from "react";
import {Platform, StyleSheet, Text, View, StatusBar, SafeAreaView, ScrollView} from "react-native";
import Video from 'react-native-af-video-player'
import Orientation from 'react-native-orientation'
type Props = {
    navigation:any,
}
export default class VideoScene extends Component<Props> {

    static navigationOptions = ({navigation}: any) => ({
            header: null,
        }
    )

    componentDidMount() {
        if (Platform.OS === 'ios') {
            Orientation.lockToLandscapeRight()
        } else {
            Orientation.lockToLandscapeLeft()
        }
    }

    constructor(props) {
        super(props)
        this.state = {
            logo: require('../../../res/img/video/video_back.png'),
        }
    }

    render() {

        const {url, title} = this.props.navigation.state.params

        console.log('$$$$$$$$$$$$$$', url)

        return (
            <SafeAreaView style={styles.container}>
                <Video
                    url={url}
                    title={title}
                    rotateToFullScreen={true}
                    logo={this.state.logo}
                    //theme={'#DB3843'}  主题颜色（包括控制按钮，进度条，标题）设置，默认是白色
                    lockPortraitOnFsExit={true}
                    logoOnPress={()=>{this.props.navigation.goBack()
                        Orientation.lockToPortrait()
                    }}
                />
            </SafeAreaView>
        )
    }
}


const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#111111',
    }
})
